import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";

import { viteMockServe } from "vite-plugin-mock";

export default defineConfig({
  plugins: [
    vue(),

    viteMockServe({
      supportTs: false,
      logger: false,
      mockPath: "./src/mock/",
    }),
  ],
  resolve: {
    alias: {
      "@": "/src",
    },
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: ` @import "@/assets/style/theme.scss";`,
      },
    },
  },
  server: {
    proxy: {
      "/api3": {
        target: "https://mock.apifox.com/m1/4093948-0-default",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api3/, ""),
      },
    },
  },
});
